package com.snake.excel2java.excel.common.ext.file;

import com.snake.excel2java.excel.common.ext.row.DropRowExt;
import com.snake.excel2java.excel.common.file.Drop;

import lombok.NoArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

@Component
@NoArgsConstructor
public class DropExt extends Drop {

	private HashMap<Integer, DropRowExt> groupMap = null;

	// 添加其他的功能
	protected void parse() {

		DropRowExt row = null;
		HashMap<Integer, DropRowExt> groupMap = new HashMap<>();
		for(Map.Entry<Integer, DropRowExt> entry: getDataMap().entrySet()) {
			row = entry.getValue();
			groupMap.put(row.getGroupId(), row);
		}

		this.groupMap = groupMap;
	}

	public DropRowExt getDropRowByGroupId(int groupId) {
		return groupMap.get(groupId);
	}

}